package com.itdfq.consumer.consumer;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.retry.MessageRecoverer;
import org.springframework.stereotype.Component;

/**
 * @Author: QianMo
 * @Date: 2021/11/16 15:29
 * @Description: 消息重试
 */
@Component
@Slf4j
public class RejectDemoRecover implements MessageRecoverer {
    @Override
    public void recover(Message message, Throwable cause) {
        log.info("达到重试次数，需要手动处理消息，message:{} ", JSON.toJSONString(message));
        log.info("cause:{}", JSON.toJSONString(cause));
    }
}
